<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	include("_include.user.judge.php");

	$kboy_userid = $_SESSION['kboy_userid'];
	$kboy_user = $_SESSION['kboy_user'];
	$uid = chkstr(trim($_REQUEST['uid']));
	$user_phone = getClassName("kboy_user","user_phone","uid = '$uid'");
	if(empty($user_phone)){
		echo ok("请绑定手机号，才可以发帖！","user_index.php");
	}
	if(empty($uid)){
		echo erro("参数错误");
	}
	if(!is_numeric($uid)){
		echo erro("参数错误");
	}
	if(getNewsNums("kboy_user","uid=$uid") <1){
		echo erro("参数错误");
	}
	$ReturnUrl = urlencode($_SERVER['HTTP_REFERER']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的游记_社区_<?= $web_titles ?></title>
<meta name="Keywords" content="我的游记,社区,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--header end-->
    <!--banner begin-->
	<? include("_include.forum.banners.php") ?>
    <!--banner end-->
    <!--活动 begin-->
    <div class="sq-wrap">
		<? include("_include.forum.title.php") ?>
        <div class="sq-bd">
			<? include("_include.forum.topnav.php") ?>
            <div class="sq-bd-con">
                <div class="editor_box">
                    <div class="editor_hd">
                        <div class="sign">写游记</div>
                        <div class="e-option"><a href="#">草稿（0）<i class="icon-more"></i></a></div>
                    </div>
                    <div class="editor-wrap">
						<form name="travelform" id="travelform" method="post" action="forum_travel_addsave.php?action=add">
						<input type="hidden" name="urlcode"  value="<?php echo $ReturnUrl;?>" />
						
                        <table class="editor-table">
                            <tbody>
                                <tr>
                                    <td class="left pl0">
                                        <label>游记标题：</label>
										</td>
                                    <td class="right">
                                        <input name="travel_title" id="travel_title" type="text" class="editor-input w790 title" value="">
									</td>
                                </tr>
                                <?php if($_GET['aid']){ ?>
                                <tr>
                                	<input type="hidden" name="aid"  value="<?php echo $_GET['aid']; ?>" />
                                    <td class="left pl0">
                                        <label>活动名称：</label>
										</td>
                                    <td class="right">
                                        <input name="title" readonly="readonly" id="travel_title" type="text" class="editor-input w790 title" value="<?php echo getClassName("kboy_forum_active","active_title","id=".$_GET['aid']);?>">
									</td>
                                </tr>
                                <?php }else{ ?>
                                <tr>
                                    <td class="left pl0">
                                        <label>活动ID：</label>
										</td>
                                    <td class="right">
                                        <input name="aid" id="travel_title" style="width: 125px;" type="text" class="editor-input w790 title" value=""> 
                                        	（<span style="color: red;">有相关活动的游记，请填写"活动ID"，或者进入活动页面添加游记</span>）
									</td>
                                </tr>	
                                <?php } ?>
                                <tr>
                                  <td class="left pl0">发布版块：</td>
                                  <td class="right">
										<div class="select-way">
                                            <select class="basic-select" name="travel_bigclass" id="travel_bigclass">
												<option value="">==请选择板块==</option>
												<?php
													$bigIDs = 115;
													getSoonClass_option($bigIDs,'',0,3); // 下拉option
												?>
                                            </select>
                                        </div>
								  </td>
                                </tr>
                                <tr>
                                    <td class="left pl0">
                                        <label>游记主图：</label>
									</td>
                                    <td class="right">
                                        <input name="travel_pic" type="text" id="travel_pic" value="" readonly="readonly" size="25" class="editor-input" style="width:350px; margin-right:10px;" />
										<div class="new-contentarea tc">
                                         <a href="javascript:void(0)" class="upload-img">
                                         <label for="upload-file">选择图片</label>
                                         </a>
										</div></td>
                                </tr>
                                <tr>
                                    <td class="left pl0">
                                        <label>游记内容：</label>
									</td>
                                    <td class="right">
                                        <textarea name="travel_content" style="width:775px;height:440px;visibility:hidden;"></textarea>
									</td>
                                </tr>
                                
                                <tr>
                                    <td class="left pl0"> </td>
                                    <td class="right" >
                                        <div class="foot-operate" style="float:right;">
                                            <a href="#" class="operate-btn save">保存草稿</a>
											<input type="submit" name="tj-btn" class="operate-btn post" value="发布游记" />
										</div>
									    <input name="user_passcode" id="travel_title" style="width: 125px;" placeholder="验证码" type="text" class="editor-input w790 title" value=""> 
                                        <span class="yzm"><img src="function/code.php" width="103" height="35" class="imgCode reshCode"/></span>
                                        <span><a href="javascript:void(0);" class="reshCode">看不清？？</a></span>
									</td>
                                </tr>
                            </tbody>
                        </table>
						</form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
    <!--左侧悬浮 end-->
    <!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
    <!--右侧悬浮导航 end-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>

<link rel="stylesheet" href="SunbeamEditor/themes/default/default.css" />
<script charset="utf-8" src="SunbeamEditor/kindeditor.js"></script>
<script charset="utf-8" src="SunbeamEditor/lang/zh_CN.js"></script>
<script type="text/javascript">
    // 刷新验证码

		$(".reshCode").click(function(){

			$(".imgCode").attr("src","function/code.php?nums=" + Math.random());   

		});
</script>
<script language="javascript">
	$("#travelform").submit(function(){
		var travel_title = $("#travel_title").val();
		var travel_bigclass = $("#travel_bigclass").val();
		var travel_pic = $("#travel_pic").val();
		if (travel_title.replace(/\ /g,"").length<1){
			alert("游记标题不能为空！");
			$("#travel_title").focus();
			return false;
		}
		if (travel_pic.replace(/\ /g,"").length<1){
			alert("游记主图不能为空！");
			$("#travel_pic").focus();
			return false;
		}
		if (travel_bigclass.replace(/\ /g,"").length<1){
			alert("请选择发布板块！");
			$("#travel_bigclass").focus();
			return false;
		}
		
	});


	KindEditor.ready(function(K) {
		var editor = K.create('textarea[name="travel_content"]', {
			cssPath : 'SunbeamEditor/plugins/code/prettify.css',
			uploadJson : 'SunbeamEditor/php/upload_json.php',
			fileManagerJson : 'SunbeamEditor/php/file_manager_json.php',
			allowFileManager : false,
			afterBlur: function(){this.sync();}
		});

		/////   点击上传图片
		var editor = K.editor({
			allowFileManager : false
		});
		K('.upload-img').click(function() {
			editor.loadPlugin('image', function() {
				editor.plugin.imageDialog({
					imageUrl : K('#travel_pic').val(),
					clickFn : function(url, title, width, height, border, align) {
						K('#travel_pic').val(url);
						editor.hideDialog();
					}
				});
			});
		});
	});

	$(document).ready(function(){
		$("#myform").submit(function(){
			var travel_title = $("#travel_title").val();
	
			if (travel_title.replace(/\ /g,"").length<1){
				alert("请输入游记标题！");
				$("#travel_title").focus();
				return false;
			}
		});
	});
</script>

</body>
</html>